package com.itheima.reggie.common;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ScheduledExecutorService;

/**
 * @author Yan
 * @date 2022/3/10
 */
public class TimeTaskDemo {
    public static void main(String[] args) {
        //创建一个Tmier
        Timer timer = new Timer();
        //ScheduledExecutorService
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("定时任务执行了");
            }
        },1000,5000);


        long now = System.currentTimeMillis()/1000;
        long daySecond = 60*60*24L;
        long dayTime4 = (now - (now + 8*3600)%daySecond)*1000L;
        System.out.println(dayTime4);
        long day2 = dayTime4+2*60*60*1000L;
        //当天凌晨2点
        Date date =new Date(day2);

        //24小时
        long period = 24*60*60*1000L;

        TimerTask task = new TimerTask() {
            @Override
            public void run() {
                //1.读取服务器磁盘文件
                //2.获取文件名称
                //3.根据图片名称去查询数据库
                //3.1查到：不处理
                //3.2查不到的：清理
            }
        };
    }
}
